home *** CD-ROM | disk | FTP | other *** search
- 'BINARY.BAS - benchmark to compare Binary and Sequential access
-
- Start! = TIMER
- OPEN "STANDARD.DAT" FOR OUTPUT AS #1
- FOR X% = 1 TO 5000
- PRINT #1, X%
- NEXT
- CLOSE #1
- Done! = TIMER
- PRINT USING "##.### seconds to write a sequential file"; Done! - Start!
-
- Start! = TIMER
- OPEN "BINARY.DAT" FOR BINARY AS #1
- FOR X% = 1 TO 5000
- PUT #1, , X%
- NEXT
- CLOSE #1
- Done! = TIMER
- PRINT USING "##.### seconds to write a binary file"; Done! - Start!
-
- Start! = TIMER
- OPEN "STANDARD.DAT" FOR INPUT AS #1
- FOR X% = 1 TO 5000
- INPUT #1, X%
- NEXT
- StandardLen& = LOF(1)
- CLOSE #1
- Done! = TIMER
- PRINT USING "##.### seconds to read a sequential file"; Done! - Start!
-
- Start! = TIMER
- OPEN "BINARY.DAT" FOR BINARY AS #1
- FOR X% = 1 TO 5000
- GET #1, , X%
- NEXT
- BinaryLen& = LOF(1)
- CLOSE #1
- Done! = TIMER
- PRINT USING "##.### seconds to read a binary file"; Done! - Start!
-
- PRINT "The standard sequential file is"; StandardLen&; "bytes long."
- PRINT " The binary file is"; BinaryLen&; "bytes long."
-
-